import React, {Component} from 'react';
// import './Admin_menu.css'
import {Button, Avatar, Menu, Icon, Layout} from 'antd';
// 蚂蚁金服属性定义
const {Sider} = Layout;
const SubMenu = Menu.SubMenu;

export default class Admin_menu extends Component {
    constructor(props) {
        super(props);
        this.state = {
            collapsed: false,
            choose_num: this.props.choose,
        }
    }

    onChangekey = (e) => {
        this.props.onChange(e.key);
    };

    render() {

        return (
                <Sider
                style={{overflow: 'auto'}}
                trigger={null}
                collapsible
                collapsed={this.state.collapsed}
                breakpoint="lg"
                // collapsedWidth="0"
                onCollapse={(collapsed, type) => {
                    console.log(collapsed, type);
                }}
            >
                <div className="logo">
                    <div className="display" style={{display: 'flex', justifyContent: 'center'}}>
                        <Avatar style={{backgroundColor: '#87d068'}} icon="user" size="large"/>
                    </div>
                    <div style={{color: 'orange', textAlign: 'center', position: 'relative'}}>USER</div>
                    <div style={{textAlign: 'center', marginTop: 5}}>
                        <Button type="primary" icon="logout" size="small" onClick={()=>window.location.href = "/"}>退出</Button>
                    </div>
                </div>
                <Menu theme="dark" mode="inline" defaultSelectedKeys={['0']}
                      onSelect={this.onChangekey}>
                    <Menu.Item key="0">
                        <Icon type="appstore"/>
                        <span className="nav-text">主面板</span>
                    </Menu.Item>
                    <Menu.Item key="1">
                        <Icon type="notification"/>
                        <span className="nav-text">通知中心</span>
                    </Menu.Item>
                    <SubMenu key="sub2" title={<span><Icon type="file"/><span>问卷管理</span></span>}>
                        <Menu.Item key="3">
                            <Icon type="file-add"/>
                            <span className="nav-text">新建问卷模板</span>
                        </Menu.Item>
                        <Menu.Item key="4">
                            <Icon type="file-text"/>
                            <span className="nav-text">问卷列表</span>
                        </Menu.Item>
                    </SubMenu>
                    <SubMenu key="sub3" title={<span><Icon type="video-camera"/><span>问卷邀请管理</span></span>}>
                        <Menu.Item key="6">
                            <Icon type="file-add"/>
                            <span className="nav-text">问卷发放列表</span>
                        </Menu.Item>
                        <Menu.Item key="7">
                            <Icon type="file-text"/>
                            <span className="nav-text">问卷邀请</span>
                        </Menu.Item>
                    </SubMenu>
                    <SubMenu key="sub4" title={<span><Icon type="user"/><span>用户管理</span></span>}>
                        <Menu.Item key="8">
                            <Icon type="user-add"/>
                            <span className="nav-text">创建用户</span>
                        </Menu.Item>
                        <Menu.Item key="9">
                            <Icon type="team"/>
                            <span className="nav-text">用户列表</span>
                        </Menu.Item>
                    </SubMenu>
                    <SubMenu key="sub5" title={<span><Icon type="key"/><span>接口管理</span></span>}>
                        <Menu.Item key="10">
                            <Icon type="form"/>
                            <span className="nav-text">接口列表</span>
                        </Menu.Item>
                        <Menu.Item key="11">
                            <Icon type="edit"/>
                            <span className="nav-text">新建接口</span>
                        </Menu.Item>
                    </SubMenu>
                    <SubMenu key="sub6" title={<span><Icon type="laptop"/><span>系统控制面板</span></span>}>
                        <Menu.Item key="12">
                            <Icon type="safety"/>
                            <span className="nav-text">系统参数</span>
                        </Menu.Item>
                    </SubMenu>

                    <SubMenu key="sub7" title={<span><Icon type="laptop"/><span>文件管理</span></span>}>
                        <Menu.Item key="13">
                            <Icon type="safety"/>
                            <span className="nav-text">文件提交</span>
                        </Menu.Item>
                    </SubMenu>

                    <SubMenu key="sub8" title={<span><Icon type="laptop"/><span>数据查询</span></span>}>
                        <Menu.Item key="15">
                            <Icon type="safety"/>
                            <span className="nav-text">本底数据</span>
                        </Menu.Item>
                        <Menu.Item key="16">
                            <Icon type="safety"/>
                            <span className="nav-text">资源消耗数据</span>
                        </Menu.Item>
                        <Menu.Item key="17">
                            <Icon type="safety"/>
                            <span className="nav-text">能源消耗数据</span>
                        </Menu.Item>
                        <Menu.Item key="18">
                            <Icon type="safety"/>
                            <span className="nav-text">替代燃料协同处置数据</span>
                        </Menu.Item>
                        <Menu.Item key="19">
                            <Icon type="safety"/>
                            <span className="nav-text">污染物排放数据</span>
                        </Menu.Item>
                        <Menu.Item key="20">
                            <Icon type="safety"/>
                            <span className="nav-text">典型案例</span>
                        </Menu.Item>
                        <Menu.Item key="21">
                            <Icon type="safety"/>
                            <span className="nav-text">调研问卷数据</span>
                        </Menu.Item>
                    </SubMenu>
                    <SubMenu key="sub9" title={<span><Icon type="laptop"/><span>系统日志</span></span>}>
                        <Menu.Item key="22">
                            <Icon type="safety"/>
                            <span className="nav-text">用户查询记录</span>
                        </Menu.Item>
                    </SubMenu>
                </Menu>
            </Sider>
        )
    }
}

